/**
 * 
 */
package model.adjacence;

import jgf.Arc;
import java.util.Vector;

/**
 * @author raistlin
 */
public class Digraph extends Graph{
	
	/**
	 * Generates a Digraph with the same code as if generating a normal Graph
	 */
	public Digraph() {
		super();
	}

	/**
	 * Generates a Digraph with numNodes number of nodes with the same code as for a Graph.
	 * @param numNodes The number of nodes
	 */
	public Digraph(int numNodes) {
		super(numNodes);
	}

	/* (non-Javadoc)
	 * @see adjacence.Graph#insertEdge(adjacence.Arc)
	 */
	@Override
	public void insertArc(Arc arc) {
		net[arc.getFrom().getId()][arc.getTo().getId()] = arc;
		numArcs++;
	}

	/* (non-Javadoc)
	 * @see adjacence.Graph#removeEdge(int, int)
	 */
	@Override
	public void removeArc(int i, int j) {
		net[i][j] = null;
		numArcs--;
	}

	/* (non-Javadoc)
	 * @see adjacence.Graph#getEdges()
	 */
	@Override
	public Vector<Arc> getArcs() {
		Vector<Arc> ret = new Vector<Arc>();
		for(int i = 0; i < this.numNodes; i++)
			for(int j = 0; j < this.numNodes; j++)
				if(net[i][j] != null)
					ret.add(net[i][j]);
		return ret;
	}
}
